Skip to content

Move ReactElementValidator to __DEV__ block#6830

Merged
jimfb merged 1 commit intofacebook:masterfrom
ruiaraujo:patch-1
May 22, 2016
Merged

Move ReactElementValidator to __DEV__ block#6830
jimfb merged 1 commit intofacebook:masterfrom
ruiaraujo:patch-1

Conversation

@ruiaraujo
Copy link
Copy Markdown
Contributor

@ruiaraujo ruiaraujo commented May 21, 2016

It saves some more bytes in production mode.

   raw     gz Compared to master @ fd589fc8dd5c8f987c6496b203f7f45f1f1fbb2e    
     =      = build/react-dom-server.js                                        
     =      = build/react-dom-server.min.js                                    
     =      = build/react-dom.js                                               
     =      = build/react-dom.min.js                                           
    +6     +1 build/react-with-addons.js                                       
 -1880   -660 build/react-with-addons.min.js                                   
    +6     -2 build/react.js                                                   
 -1875   -592 build/react.min.js       

@gaearon
Copy link
Copy Markdown
Collaborator

gaearon commented May 22, 2016

Can you post the sizes before and after? I believe they should be printed when you run the build.

It saves some more bytes in production mode.
@ruiaraujo
Copy link
Copy Markdown
Contributor Author

@gaearon done above.

@facebook-github-bot
Copy link
Copy Markdown
Contributor

@ruiaraujo updated the pull request.

@jimfb
Copy link
Copy Markdown
Contributor

jimfb commented May 22, 2016

Looks good to me. Thanks!

@jimfb jimfb merged commit d955ee9 into facebook:master May 22, 2016
@gaearon
Copy link
Copy Markdown
Collaborator

gaearon commented May 22, 2016

Wow, -600 bytes gzipped is great, thanks!

@ruiaraujo ruiaraujo deleted the patch-1 branch May 22, 2016 16:08
@ruiaraujo
Copy link
Copy Markdown
Contributor Author

@gaearon low hanging fruit is the best fruit. ;)

@zpao
Copy link
Copy Markdown
Member

zpao commented May 25, 2016

Just coming around to this. This win is going to get lost internally at FB and in the future if we move to imports, both cases where dependencies are statically analyzed. It's not the only place we do this (IIRC) so it's totally cool to do, just wanted to fill in some backstory (and make sure other FB people understand).

@zpao zpao added this to the 15.y.z milestone May 25, 2016
@gaearon
Copy link
Copy Markdown
Collaborator

gaearon commented May 26, 2016

@zpao I totally broke my mind trying to parse your second sentence, can you rephrase please? 😄

@zpao
Copy link
Copy Markdown
Member

zpao commented May 27, 2016

I'm pretty sure we have another require() in dev blocks so it's ok to do here. I just wanted to reiterate that we only get the wins here and not at FB since requires are resolved statically.

zpao pushed a commit to zpao/react that referenced this pull request Jun 8, 2016
It saves some more bytes in production mode.
(cherry picked from commit d955ee9)
zpao pushed a commit that referenced this pull request Jun 14, 2016
It saves some more bytes in production mode.
(cherry picked from commit d955ee9)
@zpao zpao modified the milestones: 15-next, 15.2.0 Jun 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants